#ifndef LIST_H_INCLUDED
#define LIST_H_INCLUDED

#include <stddef.h>

typedef struct _listnode ListNode;
//列表的实现
typedef struct _list List;
typedef struct _listcursor ListCursor;

List *ListInit();
//从末尾操作插入
void *ListPush(List *plist,void *data);
void *ListPop(List *plist);
//从前端操作插入
void *ListImport(List *plist,void *data);
void *ListExport(List *plist);
//任意位置操作
void *ListInsert(List *plist,void *data,ListCursor *pcursor);
void *ListRemove(List *plist,void *data);

int ListLength(List *plist);
List *ListEmpty(List *plist);

ListCursor *ListGetCursor(List *plist);
void ListAllocator(List *plist,void *(*pmalloc)(size_t size),void (*pfree)(void *pdata));
void *ListCursorRemove(List *plist,ListCursor *pcursor);
void *ListForeach(List *plist,ListCursor *pcursor);

#endif // LIST_H_INCLUDED
